<div style="width:100%">
	<div style="float:left; width:300px; padding:5px;">
		<fieldset class="register">
			<h3>Form Daftar</h3><hr />
			<form id="form_na" action="<?=base_url()?>backend/simpan/tbl_user" method="post">
			<input type="hidden" name="sts" id="sts" value="add"/>
			<input type="hidden" name="id" id="id" value=""/>
			<label>User Name</label> : <br /><input type="text" name="user_id" id="user_id" style="width:246px;" value="" class="easyui-validatebox text_na" placeholder="User Name Anda" /><br /><br />
			<label>Password</label> :  <br /><input type="password" name="password" id="password" style="width:246px;" value="" class="easyui-validatebox text_na" placeholder="Password Anda" /><br /><br />
			<label>Nama Lengkap</label> : <br /><input type="text" name="nama_lengkap" id="nama_lengkap" style="width:246px;" value="" class="easyui-validatebox text_na" placeholder="Nama Lengkap Anda" /><br /><br />
			<label>Email</label> :  <br /><input type="text" name="email" id="email" style="width:246px;" value="" class="easyui-validatebox text_na" placeholder="Email Anda" /><br /><br />
			<a id="register" href="#" style="float:right"><span id="nm_simpan">Daftar Sekarang</span></a>			
			</form>
		</fieldset>
	</div>
	<div style="float:left; width:300px; padding:5px;">
		<fieldset class="register">
		<form action="<?=base_url()?>login/login_na/front" method="post">
			<h3>Login</h3><hr />
			<label>User Name</label> : <br /><input type="text" name="username" id="username" style="width:246px;" value="" class="text_na" placeholder="Username" /><br /><br />
			<label>Password</label> :  <br /><input type="password" name="pass" id="pass" style="width:246px;" value="" class="text_na" placeholder="Password" /><br /><br />
			</form>
			<a id="login" href="#" style="float:right"><span id="nm_simpan">Login</span></a><br /><br /><br />
			<span style="color:navy;"><strong>Silahkan Anda Login dengan Username dan Password Anda Jika anda lupa password anda silahkan klik link dibawah ini <br /> <a href="#">Lupa Password</a></strong></span>
		</fieldset>
	</div>
</div>

<script>
$(".easyui-validatebox").validatebox({required:true } );
$('#register').linkbutton({  
			iconCls: 'accept'  
});

$('#login').linkbutton({  
			iconCls: 'group'  
});

$('#login').bind('click',function(){
	$.post(host+'login/login_na/front',{user:$('#username').val(),pass:$('#pass').val()},function(r){
		if(r==1){
			window.location.href='<?=base_url()?>frontend/'
		}
		else if(r==2){
			$.messager.alert("Login","UserName dan Password Salah",'error');
		}
		else if(r==3){
			$.messager.alert("Login","Isi UserName dan Password",'error');
		}
		else{alert(r);}
	});

});

$('#register').bind('click',function(){
if($('#form_na').form('validate')){
	$.post(host+'frontend/cek_user',{user_id:$('#user_id').val()},function(r){
		if(r=='ok'){
			submitform('form_na',function(resp){
				var resp=eval('(' + resp + ')');
				if(resp.msg==1){
					window.location.href='<?=base_url()?>backend/';
				}
			});	
		}
		else{
			$.messager.alert("Registrasi","Username Sudah Ada !! Silahkan Menggunakan Nama Username Yang Lain",'error');
		}
	});	
}
});
